import json
from dataclasses import dataclass

@dataclass
class Result:
    errno: int
    err_msg: str
    request_id: int
    randsk: str

# 示例 JSON 字符串
json_str = '{"errno":0,"err_msg":"","request_id":318700763119691952,"randsk":"Ma5f0qOdM6w8sU%2FJNophsQ23EMH3YIphuXO1d2qr7M8%3D"}'

# 将 JSON 字符串转换为字典
data = json.loads(json_str)

# 使用字典解包来创建 Result 实例
result = Result(**data)

# 打印结果以验证
print(result.errno)
